<%@ page language="java" pageEncoding="utf8"%>
<jsp:include page="/head_admin.jsp" />
<script type="text/javascript" src="./script/movieInfo.js"></script>
<script type="text/javascript">
	dojo.require("dijit.form.DateTextBox");
	dojo.require("dijit.form.SimpleTextarea");
	dojo.addOnLoad(function(){
		Movie.askForAllMovieInfo();
		dijit.byId("movieGrid").resize();
	}); 
	
	var manageAllMovies = {
       	items:[]
    };
    
    var movieTypeName = {
    items:[]
    };
    
    var manageMovieStore = new dojo.data.ItemFileWriteStore({data:manageAllMovies});
    
    var movieTypeStore = new dojo.data.ItemFileWriteStore({
    	data:movieTypeName
    });
    
	function deleteMovie(movieId) {
		if(confirm("确认删除该电影？")==true) {
			var href = "deleteMovie.do?movieId="+movieId;
			ajaxRequest(href, updateMovie, null);
		}
	}
	
	function updateMovie(ajax_request) {
		var item = dijit.byId("movieGrid").removeSelectedRows();
		manageMovieStore.deleteItem(item);
	}
	
	function showMovieSession(movieId) {
		window.location.href = "movieSessionManage.jsp?movieID="+movieId;
	}
</script>
<style type="text/css">
	#movieGrid{
		width:98%;
	}
</style>
<style type="text/css">
	.dojoxGrid table {
        margin: 0;
        font-size: 12px;
        text-align: center;
    }
</style>

<div class="maincontent">
	<div class="HackBox"></div>
	<div id="breadcrumb">
		&nbsp;
		<a href="Home.htm">主页</a>&gt;电影资讯管理
	</div>

	<div class="maincontentin">
		<table>
			<tr>
				<td style="padding-top: 8px;">
					<span class="blue-btn"> <a href="addMovie.jsp"><span class="l"></span>添加电影</a>
					</span>
				</td>
			</tr>
		</table>
		<div class="channel">
		</div>
		<div id="adminGridDiv">
			<table dojoType="dojox.grid.DataGrid" id="movieGrid" selectionMode="single"
					  autoHeight="true" store="manageMovieStore">
				<thead>
					<tr>
						<th field="movieName" width="25%">电影名</th>
						<th field="director" width="15%">导演</th>
						<th field="actors" width="20%">主演</th>
						<th field="shownTime" width="15%">上映日期</th>
						<th field="showMovieSession" width="15%">查看电影场次</th>
						<th field="deleteMovie" width="10%">删除</th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
	<!-- main content -->
</div>
<jsp:include page="footer.jsp" />